package top.chmin.project.cloud.sys.dict.type;
import java.util.stream.Stream;
import java.util.List;
import java.util.ArrayList;

import top.chmin.project.cloud.common.*;
import lombok.experimental.Accessors;
import lombok.Setter;
import lombok.Getter;



/**
 * chmin
 * 2024-01-26 14:02:38
 * cloud-code
 */
public class DictTypeCondition extends Condition {
    private DictTypeCondition parent = null;

    DictTypeCondition() {
    }

    private DictTypeCondition(DictTypeCondition condition) {
        this.parent = condition;
    }

    public static DictTypeCondition forDelete() {
        DictTypeCondition condition = new DictTypeCondition();
        condition.setSql("DELETE FROM sys_dict_type#where##group##order##limit#");
        return condition;
    }

    public static DictTypeCondition forSelect() {
        DictTypeCondition condition = new DictTypeCondition();
        condition.modelClass = DictType.class;
        condition.setSql("SELECT #select# FROM sys_dict_type#where##group##order##limit#");
        return condition;
    }

    public DictTypeCondition distinct() {
        this.distinct = true;
        return this;
    }

    public DictTypeCondition limit(int limit) {
        this.limit = " LIMIT " + limit;
        return this;
    }

    public DictTypeCondition sub() {
        return new DictTypeCondition(this);
    }

    public DictTypeCondition finish() {
        if (!whereList.isEmpty()) {
            parent.whereList.add("(" + String.join(" OR ", whereList) + ")");
        }
        parent.whereValueList.addAll(whereValueList);
        return parent;
    }

    public DictType selectFirst() {
        return selectFirst(DictType.class);
    }

    public List<DictType> selectList() {
        return selectList(DictType.class);
    }

    public Stream<DictType> selectStream() {
        return selectStream(DictType.class);
    }

    public Page<DictType> selectPage() {
        return selectPage(DictType.class);
    }

    /* append $conditionIndexAppender$ */
    /*###########auto#start###########*/
    public CreateBy createBy() {
        return new CreateBy();
    }

    public class CreateBy extends StringFlexColumn<DictTypeCondition> {
        private CreateBy() {
            super(DictTypeCondition.this, "create_by");
        }
    }

    public CreateTime createTime() {
        return new CreateTime();
    }

    public class CreateTime extends LocalDateTimeFlexColumn<DictTypeCondition> {
        private CreateTime() {
            super(DictTypeCondition.this, "create_time");
        }
    }

    public Id id() {
        return new Id();
    }

    public class Id extends IntegerFlexColumn<DictTypeCondition> {
        private Id() {
            super(DictTypeCondition.this, "id");
        }
    }

    public TypeCode typeCode() {
        return new TypeCode();
    }

    public class TypeCode extends StringFlexColumn<DictTypeCondition> {
        private TypeCode() {
            super(DictTypeCondition.this, "type_code");
        }
    }

    public TypeName typeName() {
        return new TypeName();
    }

    public class TypeName extends StringFlexColumn<DictTypeCondition> {
        private TypeName() {
            super(DictTypeCondition.this, "type_name");
        }
    }

    public UpdateBy updateBy() {
        return new UpdateBy();
    }

    public class UpdateBy extends StringFlexColumn<DictTypeCondition> {
        private UpdateBy() {
            super(DictTypeCondition.this, "update_by");
        }
    }

    public UpdateTime updateTime() {
        return new UpdateTime();
    }

    public class UpdateTime extends LocalDateTimeFlexColumn<DictTypeCondition> {
        private UpdateTime() {
            super(DictTypeCondition.this, "update_time");
        }
    }

    /*###########auto##end############*/
    /* append $conditionFieldAppender$ */
}
